/**
 * Created by 白雨浓 on 2018/12/5 12:03.
 *
 * 全局loading
 */
export default {
  install(Vue) {
    let loading;
    Vue.prototype.$$loading = {
      start(msg) {
        loading = Vue.prototype.$loading({
          lock: true,
          text: `${msg ? msg : 'Loading'} . . . `,
          spinner: 'el-icon-loading',
          background: 'rgba(200, 200, 200, .1)'
        });
      },
      close() {
        if (loading) {
          loading.close();
        }
      }
    }
  }
}